Error: invalid use of non-static member function