title: Boost.Python and Polymorphic Behaviour with std::shared_ptr
body: <p>I would like to know how classes <code>A</code> and <code>B</code> below can work polymorphically in python when using <code>std::shared_ptr</code> instead of <code>boost::shared_ptr</code>? </p>
  
  <pre><code>struct A
  {
      virtual ~A() {}
  };
  
  struct B : A
  {
      B() {}
      virtual ~B() {}
  };
  
  void f(const std::shared_ptr&lt;A&gt;&amp; ptr)
  {}
  
  BOOST_PYTHON_MODULE(test)
  {
      class_&lt;A, boost::noncopyable&gt;("A", no_init);
  
      class_&lt;B, std::shared_ptr&lt;B&gt;, bases&lt;A&gt;&gt;("B")
          .def(init&lt;&gt;());
  
      def("f", f);
  }
  </code></pre>
  
  <p>I am aware that the the <code>boost::get_pointer</code> method must be defined for <code>std::shared_ptr</code>, so I make sure that the following lines exist before a <code>#include &lt;boost/python.hpp&gt;</code>:</p>
  
  <pre><code>namespace boost {
  template&lt;class T&gt; const T* get_pointer(const std::shared_ptr&lt;T&gt;&amp; p)
  {
      return p.get();
  }
  
  template&lt;class T&gt; T* get_pointer(std::shared_ptr&lt;T&gt;&amp; p)
  {
      return p.get();
  }
  } // namespace boost
  </code></pre>
  
  <p>Now, in python I try:</p>
  
  <pre><code>&gt;&gt;&gt; from test import *
  &gt;&gt;&gt; b = B()
  &gt;&gt;&gt; f(b)
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
  ArgumentError: Python argument types in
      test.f(B)
  did not match C++ signature:
      f(std::shared_ptr&lt;A&gt;)
  </code></pre>
  
  <p>Note: The code above works fine for <code>boost::shared_ptr</code>, but I want to stick with the C++11 types instead.</p>
  
  <p>Thanks.</p>