title: Errors in std::make_shared() when trying to make shared_ptr?
body: <p>(Using Visual Studio 2010) I'm trying to create a shared_ptr of an existing class in my project (class was written a decade before std::shared_ptr existed). This class takes a non-const pointer to another object, it's empty parameter constructor is private.</p>
  
  <pre><code>class Foobar {
  public:
      Foobar(Baz* rBaz);
  
  private:
      Foobar();
  }
  </code></pre>
  
  <p>When I try to create a shared_ptr to it, things don't go well:</p>
  
  <pre><code>Baz* myBaz = new Baz();
  std::shared_ptr&lt;Foobar&gt; sharedFoo = std::make_shared&lt;Foobar&gt;(new Foobar(myBaz));
  </code></pre>
  
  <p>On VS2010, this gives me</p>
  
  <pre><code>error C2664: 'Foobar::Foobar(const Foobar &amp;)' : cannot convert parameter 1 from 'Foobar *' to 'const Foobar &amp;'
  3&gt;          Reason: cannot convert from 'Foobar *' to 'const Foobar'
  </code></pre>
  
  <p>For some reason it appears to be calling the copy constructor of <code>Foobar</code> instead of the constructor that takes a <code>Baz*</code>. </p>
  
  <p>I'm also not sure about the <code>cannot convert from 'Foobar *' to 'const Foobar'</code> part. My best interpretation is that my templated-type of <code>shared_ptr&lt;Foobar&gt;</code> is wrong. I made it <code>shared_ptr&lt;Foobar*&gt;</code> but this seems wrong, all examples I've seen don't make the type a raw pointer.</p>
  
  <p>It seems that making everything <code>shared_ptr&lt;Foobar*&gt;</code> compiles properly, but will that prevent the <code>Foobar</code> object from getting deleted properly when all <code>shared_ptr</code>'s go out of scope?</p>
  
  <p><strong>Edit:</strong> This seems related, but I'm not using Boost: <a href="https://stackoverflow.com/questions/1373896/boost-make-shared-takes-in-a-const-reference-any-way-to-get-around-this">boost make_shared takes in a const reference. Any way to get around this?</a></p>
  
  <p><strong>Edit2:</strong> For clarity, if you're wondering why I'm using <code>make_shared()</code>, in my actual code the <code>sharedFoo</code> variable is a class member of a third class (independent of <code>Foobar</code> and <code>Baz</code>).</p>