title: When adding elements to linked list and writing out all elements the first element doesen't write out
body: <p>I have a problem with my linked list when writing out the elements:
  <strong>When running main.cpp I get the following output:</strong></p>
  
  <pre><code>myList.endInsert(5);
      cout &lt;&lt; myList &lt;&lt; endl;     output: nothing
      myList.headInsert(3);
      cout &lt;&lt; myList &lt;&lt; endl;     output : 3
      myList.headInsert(2);
      cout &lt;&lt; myList &lt;&lt; endl;     output : 3 2
  </code></pre>
  
  <p>I <strong>figured the prboble is probably either in headinsert or how i costructed my operator >>:
  Coder for headinsert:</strong></p>
  
  <pre><code>void IntList::headInsert(int the_number)
  {
      if (head == NULL) //if list is empty
      {
          head = new IntNode; //create new dynamic variable
          head -&gt; data = the_number; //add value to new variable
          head -&gt; link = NULL; //    }
      else
      {
          NodePtr temp = new IntNode;
          temp -&gt; data = the_number;
          temp -&gt;link = head; //temp pointer becomes head
          head = temp; //head becomes temp
      }
  
  **And here is the friend function for the operator:**
  
  
  
   ostream&amp; operator &lt;&lt;(ostream&amp; outs, const IntList&amp; lis)
      {
  
        for(NodePtr temp = lis.head; temp-&gt;getLink() != NULL; temp = temp-&gt;getLink())
        {
  
          if( temp-&gt;getLink() != NULL)
            {
                outs &lt;&lt; " ";
                outs &lt;&lt; temp-&gt;getData();
            }
  
        }
        return outs;
      }
  </code></pre>
  
  <p>Can anyone shed some light on what might be wrong?</p>
  
  <p>Thanks in advance!</p>