title: overloading "<<" with a struct (no class) cout style
body: <p>I have a struct that I'd like to output using either 'std::cout' or some other output stream.
  Is this possible without using classes?</p>
  
  <p>Thanks</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  template &lt;typename T&gt;
  struct point{
    T x;
    T y;
  };
  
  template &lt;typename T&gt;
  std::ostream&amp; dump(std::ostream &amp;o,point&lt;T&gt; p) const{
    o&lt;&lt;"x: " &lt;&lt; p.x &lt;&lt;"\ty: " &lt;&lt; p.y &lt;&lt;std::endl;
  }
  
  
  template&lt;typename T&gt;
  std::ostream&amp; operator &lt;&lt; (std::ostream &amp;o,const point&lt;T&gt; &amp;a){
    return dump(o,a);
  }
  
  
  int main(){
    point&lt;double&gt; p;
    p.x=0.1;
    p.y=0.3;
    dump(std::cout,p);
    std::cout &lt;&lt; p ;//how?
    return 0;
  }
  </code></pre>
  
  <p>I tried different syntax' but I cant seem to make it work.</p>