title: C++ Operator Overload and Inheritance
body: <p>So I have a generic Matrix class that I created which has the following operator overload:</p>
  
  <pre><code>class Matrix
  {
  public:
      Matrix() {}
      Matrix(int i, int j, int k) {}
      Matrix operator*(const Matrix &amp;right)
      {
      }
  };
  </code></pre>
  
  <p>I also have a Matrix2 class that inherits from my Matrix class.</p>
  
  <pre><code>class Matrix2 : public Matrix
  {
  };
  </code></pre>
  
  <p>When I try to multiply two Matrix2 objects together I get a compiler error stating:</p>
  
  <p>'there is no operator found which takes a left hand operand of type Matrix2 (or there is no accessible conversion)'</p>
  
  <p>Why is this and how can I properly implement operator overloads with inheritance?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As pointed out my problem was partially because of the "most vexing parse". Now my problem, I believe, strictly has to do with the operator overload and inheritance.</p>
  
  <p>I can multiply two Matrix objects just fine, but I cannot multiply two Matrix2 objects together.</p>
  
  <pre><code>Matrix2 i;
  Matrix2 m;
  Matrix result = m * i;
  </code></pre>
  
  <p>The error message:</p>
  
  <blockquote>
    <p><code>error C2678: binary '*' : no operator found which takes a left-hand operand of type 'Matrix2' (or there is no acceptable conversion).</code></p>
  </blockquote>