Internal change

PiperOrigin-RevId: 16272729
Change-Id: Idc90ef52177abef24ed25503bccac76534eb5cdc
diff --git a/googleurl/src/url_test_utils.h b/googleurl/src/url_test_utils.h
index 8432945..f2b97e9 100644
--- a/googleurl/src/url_test_utils.h
+++ b/googleurl/src/url_test_utils.h
@@ -74,11 +74,17 @@
 
 }  // namespace url_test_utils
 
-// This operator allows EXPECT_EQ(aUTF16String, anotherUTF16String); to work.
-inline std::ostream& operator<<(std::ostream& os,
-                                const url_canon::UTF16String& str) {
+// This operator allows EXPECT_EQ(aUTF16String, anotherUTF16String); to work. It
+// has to be defined in the ::std namespace to allow it to be found via ADL for
+// UTF16String-type arguments as those are actually std::basic_string<...>. The
+// typedef doesn't contribute the url_canon namespace to the set of associated
+// namespaces searched during ADL. See C++'03 [basic.lookup.koenig] 3.4.2/2 for
+// more details.
+namespace std {
+inline ostream& operator<<(ostream& os, const ::url_canon::UTF16String& str) {
   // Convert to UTF-8 and print the string
-  return os << url_test_utils::ConvertUTF16ToUTF8(str);
+  return os << ::url_test_utils::ConvertUTF16ToUTF8(str);
 }
+}  // namespace std
 
 #endif  // GOOGLEURL_SRC_URL_TEST_UTILS_H__