title: how to remove error of output opertor overloading of a template class
body: <pre><code>friend ostream&amp; operator&lt;&lt; (ostream&amp; os,const aList&lt;T&gt;&amp;);
  
  template &lt;class T&gt;
  ostream &amp; operator &lt;&lt; (ostream &amp;output,const aList&lt;T&gt;&amp; a){
      output&lt;&lt;a.length;
      return output; 
  }
  </code></pre>
  
  <p>.....................................</p>
  
  <pre><code>error: g++    -c -g -MMD -MP -MF "build/Debug/Cygwin-Windows/aList.o.d" -o build/Debug/Cygwin-Windows/aList.o aList.cpp
  In file included from aList.cpp:2:0:
  aList.h:22:68: warning: friend declaration ‘std::ostream&amp; operator&lt;&lt;(std::ostream&amp;, const aList&lt;T&gt;&amp;)’ declares a non-template function [-Wnon-template-friend]
               friend ostream&amp; operator&lt;&lt; (ostream&amp; os,const aList&lt;T&gt;&amp;);
                                                                      ^
  aList.h:22:68: note: (if this is not what you intended, make sure the function template has already been declared and add &lt;&gt; after the function name here) 
  mkdir -p dist/Debug/Cygwin-Windows
  g++     -o dist/Debug/Cygwin-Windows/alist build/Debug/Cygwin-Windows/_ext/2ebfcef6/newstring.o build/Debug/Cygwin-Windows/aList.o build/Debug/Cygwin-Windows/alist1.o 
  build/Debug/Cygwin-Windows/alist1.o: In function `main':
  /cygdrive/c/Users/Zunera Jamal/Documents/NetBeansProjects/aList/alist1.cpp:50: undefined reference to `operator&lt;&lt;(std::ostream&amp;, aList&lt;newstring&gt; const&amp;)'
  /cygdrive/c/Users/Zunera Jamal/Documents/NetBeansProjects/aList/alist1.cpp:50:(.text+0x2ca): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `operator&lt;&lt;(std::ostream&amp;, aList&lt;newstring&gt; const&amp;)'
  </code></pre>