title: How to fix a "invalid operands to binary expression" error?
body: <p>I am inexperienced of using c++ and stuck at the point where compiler generates <strong>invalid operands to binary expression</strong></p>
  
  <pre><code>class Animal{
  public:
      int weight;
  };
  
  int main(){
      Animal x, y;
      x.weight = 33;
      y.weight = 3;
  
      if(x != y) {
      // do something
       }
  }
  </code></pre>
  
  <p>I want to use x and compare with y, without modifying code i.e. (x.weight != y.weight)in the main code. How should I approach this problem from external class or definition ?</p>