title: C++ shared_ptr can't see member function from class type
body: <p>I'm attempting to use shared pointers for the first time and I'm running into a problem that I can't access the member functions of Element from the pointer. I've looked at examples around the web, and it seems as though it should be possible to access the Element's functions, but I suspect I've done something wrong in setting up the pointers, but I can't work out what.</p>
  
  <p>How do I access public member functions in Element from a shared_ptr? 
  (I'm using Xcode 5.1.1)</p>
  
  <pre><code>#include &lt;memory&gt;    
  #include &lt;iostream&gt;
  class Element
  {
  
  private:
      std::string name;
      std::shared_ptr&lt;Element&gt; * firstChild;
      std::shared_ptr&lt;Element&gt; * lastChild;
      std::shared_ptr&lt;Element&gt; * nextSibling;
  
  public:
      void addChild(std::shared_ptr&lt;Element&gt; * child)
      {
          if (lastChild != nullptr) {
              lastChild-&gt;setNextSibling(child); //Error: No member named 'setNextSibling' in 'std::__1::shared_ptr&lt;Element&gt;'
              lastChild = child;
          }
          else {
              firstChild = lastChild = child;
          }
      }
  
      void setNextSibling(std::shared_ptr&lt;Element&gt;* p)
      {
          nextSibling = p;
      }
  };
  </code></pre>