I have this defined in my class
and i'm getting this error; error C2511: 'Matrix &Matrix::operator ^(int)' : overloaded member function not found in 'Matrix'
Matrix& operator^(int&); // in class Matrix
Matrix& Matrix :: operator^(int n)
Matrix M = *this;
for(int i=0; i<n-1; i++)
M = M * (*this);
Look at the argument. In your class declaration you have int&, but in the definition you only have int (no reference).
You don't probably want to pass the argument by (non-const) reference, because this means you can't use the operator as:
Also, you are returning a reference to a local, and operator ^ means XOR, not exponentiation.
Matrix m, n;
n = m ^ 5;