title: Using find in map with user defined class as key
body: <p>I have define a class Entry with 2 integer values a and b, and a vector of Entry 'e'. Now, I am going to define a map' m' of Entry and int where int is number of time that entry appear in vector. The thing is find function is considering Entry(1,2),Entry(1,12) and Entry(1,13) as one. Two entries should be same when both a and b are equal. But here if only a is equal its considering the two entries as same.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;map&gt;
  #include&lt;vector&gt;
  using namespace std;
  class Entry{
      public:
          int a;
          int b;
          Entry(int,int);
          bool operator &lt;(Entry);
          bool operator &gt;(Entry);
          bool operator ==(Entry);
  };
  Entry::Entry(int x,int y):a(x),b(y){
  }
  bool Entry::operator ==(Entry e){
      if(a==e.a &amp;&amp; b==e.b)
          return true;
      else
          return false;
  }
  bool Entry:: operator &lt;(Entry e){
      if(a&lt;e.a)
          return 1;
      else
          return 0;
  }
  bool Entry:: operator &gt;(Entry e){
      if(a&gt;e.a)
          return 1;
      else
          return 0;
  }
  int main(){
      map&lt;Entry,int&gt; m;
      vector&lt;Entry&gt; e;
      e.push_back(Entry(1,2));
      e.push_back(Entry(10,21));
      e.push_back(Entry(1,13));
      e.push_back(Entry(1,2));
      e.push_back(Entry(1,12));
      for(int i=0;i&lt;e.size();i++){
          if(m.find(e[i])==m.end())
              m[e[i]]=1;
          else{
              m[e[i]]=m[e[i]]+1;cout&lt;&lt;e[i].a&lt;&lt;" "&lt;&lt;e[i].b&lt;&lt;" "&lt;&lt;m[e[i]]&lt;&lt;endl;
  
          }
      }
  
  
  
  }
  </code></pre>