Unfortunately, you cannot get around this.
Even if your class definition is as follows:
class A { private: std::string* id; public: void f(); };
then there is still not much that can be done, since the forward declaring std::basic_string<char, etc> is a pain in the ass. I'm not even going to demonstrate.
Fortunately, although using namespace std in the headers is definitely no-no, you can usually get away with the standard #include headers in your own headers without worrying about it.
source share