title: How to use find algorithm with a vector of pointers to objects in c++?
body: <p>I want to find in a vector of Object pointers for a matching object. Here's a sample code to illustrate my problem:</p>
  
  <pre><code>class A {
  public:
      A(string a):_a(a) {}
      bool operator==(const A&amp; p) {
          return p._a == _a; 
      }
  
  private: 
      string _a;
  };
  
  vector&lt;A*&gt; va;
  
  va.push_back(new A("one"));
  va.push_back(new A("two"));
  va.push_back(new A("three"));
  
  find(va.begin(), va.end(), new A("two"));
  </code></pre>
  
  <p>I want to find the second item pushed into the vector. But since vector is defined as a pointers collection, C++ does not use my overloaded operator, but uses implicit pointer comparison. What is the preferred C++-way of solutiono in this situation?</p>