title: i have done the <<operator overloading but it's not working
body: <p>i have overloaded the '&lt;&lt;' operator in the linked class implementation, and i declared the .cpp file in my main function, but it's not working, and this error occurs:
  <strong>undefined reference to operator&lt;&amp; list)</strong></p>
  
  <p>this is the declaration of the ostream function in linkedlist.h file:</p>
  
  <pre><code>  friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, LinkedList&lt;T&gt;&amp; list);
  </code></pre>
  
  <p>and this is the implementation of the ostream function:</p>
  
  <pre><code> template &lt;typename T&gt;
     std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, LinkedList&lt;T&gt; list) 
   {
    list.current = list.start;
    while(list.current != NULL)
      {
          os&lt;&lt; list.current-&gt;info&lt;&lt;" -&gt; ";
          list.current = list.current-&gt;next;
      }
      os&lt;&lt;"NULL"&lt;&lt;endl;
      return os;
   }
  </code></pre>
  
  <p>In the main function, I have created a list that has object from SavingAccount class</p>
  
  <pre><code>LinkedList &lt;SavingAccount&gt; list;
  </code></pre>
  
  <p>and the error occurs in the main function in this line:</p>
  
  <pre><code> cout &lt;&lt; list &lt;&lt;endl;
  </code></pre>
  
  <p>well.. this is the LinkedList class implementation:</p>
  
  <pre><code>#include "LinkedList.h"
  #include "SavingAccount.h"
  #include &lt;cstddef&gt;
  using namespace std;
  
  template &lt;typename T&gt;
  LinkedList&lt;T&gt;::LinkedList()
  {
     start = NULL;
     current = NULL;
  }
  template &lt;typename T&gt;
  LinkedList&lt;T&gt;::~LinkedList()
    {
      // Add code.
    }
  
    template &lt;typename T&gt;
     std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os,const LinkedList&lt;T&gt;&amp; list) {
      list.current = list.start;
      while(list.current != NULL)
      {
          os&lt;&lt; list.current-&gt;info&lt;&lt;" -&gt; ";
          list.current = list.current-&gt;next;
      }
      os&lt;&lt;"NULL"&lt;&lt;endl;
      return os;
    }
  </code></pre>
  
  <p>and this is the header file of LinkedLins class:</p>
  
  <pre><code>#ifndef LINKEDLIST_H
  #define LINKEDLIST_H
  #include&lt;iostream&gt;
  
  using namespace std;
  
  
  template &lt;typename T&gt;
  struct Node{
      T info;
      Node&lt;T&gt; *next;
  };
  
  template &lt;typename T&gt;
  
  class LinkedList
  {
      Node&lt;T&gt; *start;
      Node&lt;T&gt; *current;
  public:
      LinkedList();
      ~LinkedList();
      friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, const LinkedList&lt;T&gt;&amp; list);
  
    };
  
  #endif // LINKEDLIST_H
  </code></pre>
  
  <p>i hope you guys can help me with that, your help is much appreciated </p>