title: cout an instance in it's constructor function
body: <p>I know this may sound strange, and there ways get around this.but I just wonder if it is possible in c++.</p>
  
  <pre><code>class Item{
       public:
              string name;
       Item(string input){
              name = input
              cout &lt;&lt; this;  // unfortunately the std::ostream&amp; operator&lt;&lt;(std::ostream&amp; outstream, Item* item) are not parsed by compiler yet. and this simply prints out its address.
                  cout &lt;&lt; *this; //I don't know how to override `cout &lt;&lt; Item`.
       }
  }
  
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; outstream, Item* item){
      outstream &lt;&lt; item-&gt;name;
      return outstream;
  }
  
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; outstream, Item&amp; item){
      outstream &lt;&lt; item.name;
      return outstream;
  }
  </code></pre>