Messed about with classes in c++