C++ query works