As explained on cppreference, using namespace
doesn't bring the names into the current scope. It brings them to the most nested common enclosing namespace of the current namespace and the one you're importing.
In this case that common namespace is ::
, so it behaves as if you declared your operators in the global namespace. They are understandably shadowed by ns::operator<<
when inside of namespace ns
.