title: base operand of ‘->’ has non-pointer type
body: <p>I'm having trouble overloading my <code>&lt;&lt;</code> output operator. The error doesn't seem to be the overload itself, but the implementation within it because the same error occurs for the <code>value()</code> function.</p>
  
  <p>The error (cygwin):</p>
  
  <blockquote>
    <p>DeckOfCards.cpp: In function <code>std::ostream&amp;
    deck::operator&lt;&lt;(std::ostream&amp;, const deck::LinkedList&amp;)</code>:<br>
    DeckOfCards.cpp:81:20: error: base operand of <code>-&gt;</code> has non-pointer
    type <code>const deck::LinkedList</code></p>
  
  <pre><code>    return os &lt;&lt; list-&gt;value();
  </code></pre>
    
    <hr>
    
    <p>DeckOfCards.cpp: In member function <code>void
    deck::DeckOfCards::value(deck::LinkedList&amp;)</code>:<br>
    DeckOfCards.cpp:100:15: error: base operand of <code>-&gt;</code> has non-pointer
    type <code>deck::LinkedList</code></p>
  
  <pre><code>    cout &lt;&lt; list-&gt;getListData();
  </code></pre>
  </blockquote>
  
  <p>Here's the relevant code:</p>
  
  <h3>DeckOfCards.cpp</h3>
  
  <pre><code>// overloaded cout operator                              
  ostream&amp; operator &lt;&lt; (ostream&amp; os, const LinkedList&amp; list) {
      return os &lt;&lt; list-&gt;value();
  }
  
  
  // returns all cards as a string
  void DeckOfCards::value(LinkedList&amp; list) {
      cout &lt;&lt; list-&gt;getListData();
  }
  </code></pre>
  
  <h3>LinkedList.cpp</h3>
  
  <pre><code>Node::value_type LinkedList::getListData() {
      for (current = head; current != NULL; current = current-&gt;getNext()) {
          contents += current-&gt;getData() + " ";
      }
      return contents;
  }
  </code></pre>
  
  <p>Why do I get those errors?</p>