title: How to call a method from parent classes that are instances of the same template [boost::enable_shared_from_this]
body: <p>I have the following code.</p>
  
  <pre><code>class A: public boost::enable_shared_from_this&lt;A&gt; {
    public:
      virtual ~A() {}
      boost::shared_ptr&lt;A&gt; returnMe() {
        return shared_from_this();
      }
  };
  
  class B: public A, public boost::enable_shared_from_this&lt;B&gt; {
      boost::shared_ptr&lt;B&gt; returnMe() {
        return shared_from_this();
      }
  };
  </code></pre>
  
  <p>gcc complains that the shared_from_this is ambiguous. 
  * In this case, is it safe to use <code>boost::enable_shared_from_this&lt;B&gt;::shared_from_this()</code> or
  <code>this-&gt;boost::enable_shared_from_this&lt;B&gt;::shared_from_this()</code>
  in the returnMe of B?
  * Both A and B inherited from enable_shared_from_this with different parameters. Does it seem correct? Or I need to do something else?
  If B does not inherit enable_shared_from_this, using <code>shared_from_this()</code> in B returns <code>shared_ptr&lt;A&gt;</code>. If so, is it safe to <code>static_pointer_cast</code> it to be <code>shared_ptr&lt;B&gt;</code>?</p>