core+daemon: declare all equality operators as hidden friends

Change-Id: Id832ee1fb16fb6742879c8b87f56002f94745103
diff --git a/daemon/face/network-predicate.hpp b/daemon/face/network-predicate.hpp
index 5a758da..8e0bd52 100644
--- a/daemon/face/network-predicate.hpp
+++ b/daemon/face/network-predicate.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -57,15 +57,6 @@
   assign(std::initializer_list<std::pair<std::string, std::string>> whitelist,
          std::initializer_list<std::pair<std::string, std::string>> blacklist);
 
-  bool
-  operator==(const NetworkPredicateBase& other) const;
-
-  bool
-  operator!=(const NetworkPredicateBase& other) const
-  {
-    return !this->operator==(other);
-  }
-
 private:
   virtual bool
   isRuleSupported(const std::string& key) = 0;
@@ -79,6 +70,20 @@
   void
   parseList(std::set<std::string>& set, std::initializer_list<std::pair<std::string, std::string>> list);
 
+private: // non-member operators (hidden friends)
+  friend bool
+  operator==(const NetworkPredicateBase& lhs, const NetworkPredicateBase& rhs)
+  {
+    return lhs.m_whitelist == rhs.m_whitelist &&
+           lhs.m_blacklist == rhs.m_blacklist;
+  }
+
+  friend bool
+  operator!=(const NetworkPredicateBase& lhs, const NetworkPredicateBase& rhs)
+  {
+    return !(lhs == rhs);
+  }
+
 NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   std::set<std::string> m_whitelist;
   std::set<std::string> m_blacklist;