Implement LWG 3065: Make path operators friends.

This prevents things like:

using namespace std::filesystem;
auto x = L"a/b" == std::string("a/b");

llvm-svn: 349884
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 49b183a9ecf62bc1b37e53bdddf42e6ea4ce4cd7
diff --git a/include/filesystem b/include/filesystem
index 06a0eb3..af713a0 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -1151,6 +1151,31 @@
     return __is;
   }
 
+  friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) == 0;
+  }
+  friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) != 0;
+  }
+  friend _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) < 0;
+  }
+  friend _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) <= 0;
+  }
+  friend _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) > 0;
+  }
+  friend _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs, const path& __rhs) noexcept {
+    return __lhs.compare(__rhs) >= 0;
+  }
+
+  friend _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs,
+                                                  const path& __rhs) {
+    path __result(__lhs);
+    __result /= __rhs;
+    return __result;
+  }
 private:
   inline _LIBCPP_INLINE_VISIBILITY path&
   __assign_view(__string_view const& __s) noexcept {
@@ -1167,43 +1192,6 @@
 _LIBCPP_FUNC_VIS
 size_t hash_value(const path& __p) noexcept;
 
-inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs,
-                                                 const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) == 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs,
-                                                 const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) != 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs,
-                                                const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) < 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs,
-                                                 const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) <= 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs,
-                                                const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) > 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs,
-                                                 const path& __rhs) noexcept {
-  return __lhs.compare(__rhs) >= 0;
-}
-
-inline _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs,
-                                                const path& __rhs) {
-  path __result(__lhs);
-  __result /= __rhs;
-  return __result;
-}
-
 template <class _Source>
 _LIBCPP_INLINE_VISIBILITY
     typename enable_if<__is_pathable<_Source>::value, path>::type