title: Is there a way to initialize a class with constructed class without using std::move?
body: <pre><code>// Example program
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;utility&gt;
  
  class A {
  public:
      int x; 
  };
  
  class B {
  public:
      B(A &amp;&amp;a) : m_a(std::move(a)) {}
      A m_a;
  };
  
  int main()
  {
      B var(std::move(A()));
      // B var(A()); // does not compile why?
  
      std::cout &lt;&lt; var.m_a.x &lt;&lt; "\n";
  
  }
  </code></pre>
  
  <p>In the above snippet the commented out line doesn't compile. The error message appears that it's treating var like a function declaration. Even if A has a parameter for constructor it's still treated like a function declaration. Is there a way to write it so it won't be treated like function declaration? Using typename doesn't help in this case.</p>