title: Using ostream_iterator and operator << to display a vector of pointers
body: <p>I'm trying to display a vector of pointers on objects using <code>ostream_iterator</code> and the <code>operator &lt;&lt;</code>. Thus, I override the <code>operator &lt;&lt;</code>. The problem that I always get the vector elements address. How do I make the iterator to print the actual values? Do I need to specialize it?</p>
  
  <pre><code>class A {
  private:
      double x;
      long y;
  public:
  
      A(long xx, double yy) :x(xx), y(yy){};
      ~A();
      void Display();
  };
  
  template&lt;typename T&gt;
  std::ostream &amp;operator &lt;&lt;(std::ostream &amp;os, const std::vector&lt;T&gt; &amp;v) {
      using namespace std;
      copy(v.begin(), v.end(), ostream_iterator&lt;T&gt;(os, "\n"));
      return os;
  }
  
  int main()
  {
      std::vector&lt;A*&gt; aVect;
      FillA(aVect);
      cout &lt;&lt; accountVect;
  
      return 0;
  }
  //
  output
  00657990
  006579D0
  00657A48
  </code></pre>