title: Overloading comparison operators in derived class right private inheritance
body: <p>I've got two classes here. A Base class:</p>
  
  <pre><code>class A
  {
      int x;
  public:
      A(int n):x(n){}
  
      friend bool operator==(const A&amp; left, const A&amp; right)
      {return left.x==right.x;}
  };
  </code></pre>
  
  <p>and a derived class that inherits from A privately:</p>
  
  <pre><code>class B : private A
  {
      int y;
  public:
      B(int n,int x):A(x),y(n){}
      friend bool operator==(const B&amp; left, const B&amp; right)
      {
          if(left.y==right.y)
          {/*do something here...*/}
          else{return false;}
      }
  };
  </code></pre>
  
  <p>I know how to compare two instances of A: I just the member variables to each other. But how can I possibly compare instances of B? two instances could easily have different "x" members inside their associated "A" instances, but I have no idea how to compare those instances to each other.</p>