Consider the following program:
#include
#include
#include
#include
using namespace std; //j
Adding an overload of operator>> in namespace std is forbidden, but adding a template specialization is sometimes allowed.
However, there are no user-defined types here, and the operators on standard types are not yours to redefine. Specializing operator>>(istream&, pair would be reasonable.
section [namespace.std] (section 17.6.4.2.1 of n3290) says
The behavior of a C++ program is undefined if it adds declarations or definitions to namespace
stdor to a namespace within namespacestdunless otherwise specified. A program may add a template specialization for any standard library template to namespacestdonly if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.
(emphasis mine)