title: using a template class as an argument
body: <p>Is there any way of creating a function that accepts any version of a given 
  template class?</p>
  
  <p>e.g. this works:</p>
  
  <pre><code>ostream&amp; operator &lt;&lt; (ostream &amp;out,const Vector&lt;int&gt;&amp; vec);
  </code></pre>
  
  <p>but this doesn't:</p>
  
  <pre><code>ostream&amp; operator &lt;&lt; (ostream &amp;out,const Vector&amp; vec);
  </code></pre>
  
  <p>Is it possible to get the second line to work somehow for any version of vector?
  e.g. <code>vector&lt;int&gt;</code> and <code>vector&lt;double&gt;</code> without having to write 2 separate functions?</p>
  
  <p>Added to question:</p>
  
  <p>I've made op&lt;&lt; a template function like you've suggested. In order to make it a friend function of the vector class I tried adding the following to the Vector class definition, but it didn't work: </p>
  
  <pre><code>friend ostream&amp; operator &lt;&lt; (ostream &amp;out, const Vector&lt;T&gt;&amp; vec); 
  </code></pre>
  
  <p>any ideas what can be done to fix it?</p>