title: c++ error C2662 cannot convert 'this' pointer from 'const Type' to 'Type &'
body: <p>I am trying to overload the c++ operator== but im getting some errors... </p>
  
  <p>error C2662: 'CombatEvent::getType' : cannot convert 'this' pointer from 'const CombatEvent' to 'CombatEvent &amp;'</p>
  
  <p>this error is at this line</p>
  
  <pre><code>if (lhs.getType() == rhs.getType())
  </code></pre>
  
  <p>see the code bellow:</p>
  
  <pre><code>class CombatEvent {
  
  public:
      CombatEvent(void);
      ~CombatEvent(void);
  
      enum CombatEventType {
          AttackingType,
          ...
          LowResourcesType
      };
  
      CombatEventType getType();
      BaseAgent* getAgent();
  
      friend bool operator&lt;(const CombatEvent&amp; lhs, const CombatEvent&amp; rhs) {
  
          if (lhs.getType() == rhs.getType())
              return true;
  
          return false;
      }
  
      friend bool operator==(const CombatEvent&amp; lhs, const CombatEvent&amp; rhs) {
  
          if (lhs.getType() == rhs.getType())
              return true;
  
          return false;
      }
  
  private: 
      UnitType unitType;
  }
  </code></pre>
  
  <p>can anybody help?</p>