I have found the following code in the Internet. It works and the string receives "Yes". But this is not the operator overload syntax that I know.
Thanks any help
Code:#include <string> using namespace std; class T { public: operator string () { return "Yes"; } }; int main() { string s; T t; s = t; return 0; }