title: error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'
body: <p>Currently I am trying to use a <code>std::unique_ptr</code>, but I'm getting a compiler error in Visual Studio 2012.</p>
  
  <pre><code>class A
  {
  private:
   unique_ptr&lt;A&gt; other;
  public:
   unique_ptr&lt;A&gt; getOther()
   {
     return other;
   }
  };
  </code></pre>
  
  <p>And the error is: </p>
  
  <pre><code>error C2248: 'std::unique_ptr&lt;_Ty&gt;::unique_ptr' : cannot access private member declared in class 'std::unique_ptr&lt;_Ty&gt;'
  with
  [
      _Ty=A
  ]
  c:\program files (x86)\microsoft visual studio 11.0\vc\include\memory(1447) : see declaration of 'std::unique_ptr&lt;_Ty&gt;::unique_ptr'
  with
  [
      _Ty=A
  ]
  </code></pre>