[c++] cannot call member function without object