operator<<(std::basic_ostream&, std::basic_string) is a function template and user defined conversions are not considered during template argument deduction. You need to overload operator<< for your class.
Another option, of course, is a cast
std::cout << static_cast(test);