title: ostream friend function of specialized template class
body: <pre><code>template &lt;&gt; 
  class test&lt;int&gt; {
      int y; 
  public:     
      test(int k) : y(k) {}     
      friend ofstream&amp; operator&lt;&lt; &lt;test&lt;int&gt;&gt; (ofstream&amp; os, const test&lt;int&gt;&amp; t); 
  };  
  template&lt;&gt; 
  ofstream&amp; operator&lt;&lt; &lt;test&lt;int&gt; &gt; (ofstream&amp; os, const test&lt;int&gt;&amp; t) 
  {
      os &lt;&lt; t.y;
      return os;
  }  
  </code></pre>
  
  <p>The code above is specialized template class of test in a int version. I am trying to overload ofstream operator&lt;&lt; function. But it shows error message;</p>
  
  <blockquote>
    <p>C2027: use of undefined type 'std::basic_ofstream&lt;_Elem,_Traits>'</p>
  </blockquote>
  
  <p>Besides, the same method works on a ordinary function (not ofstream operator&lt;&lt; but the function that I make) Is there anyway to us operator&lt;&lt; function of ofstream in a specialized template class ? </p>