You have declared your function as friend
. It’s not a member of the class. You should remove Matrix::
from the implementation. friend
means that the specified function (which is not a member of the class) can access private member variables. The way you implemented the function is like an instance method for Matrix
class which is wrong.