title: Using shared_ptr with multi inheritance class
body: <p>I have an class which inherit two interfaces:</p>
  
  <pre><code>class Multi : public IFoo, public IBar {
  public:
    virtual ~Multi();
  
    // Foo part
    virtual void fooMethod();
    // ...
  
    // Bar part
    virtual void barMethod();
    // ...
  };
  </code></pre>
  
  <p>Unfortunately this class cannot be decomposed in two separate classes for each interface. In fact in class implementation those entities (Foo and Bar) are tightly coupled, but in future they could become separate.</p>
  
  <p>Another one class wants to use Multi class, having a pointer to IFoo and IBar:</p>
  
  <pre><code>class ClientClass {
      public:
         ClientClass(); // constructor
         // smth
      private:
         std::shared_ptr&lt;IFoo&gt; foo_;
         std::shared_ptr&lt;IBar&gt; bar_;
  };
  </code></pre>
  
  <p>In constructor I do something like:</p>
  
  <pre><code>ClientClass::ClientClass(){
      auto pMulti = new Multi;
      foo_ = std::shared_ptr&lt;IFoo&gt;(pMulti);
      bar_= std::shared_ptr&lt;IBar&gt;(pMulti);  
  }
  </code></pre>
  
  <p>But each of those shared pointers has separate reference counter, and it leads to deleting already deleted pointer on class destruction, am I right?</p>
  
  <ol>
  <li>How should I treat it?</li>
  <li>What is best practics for such case?</li>
  </ol>