diff --git a/include/opendht/sockaddr.h b/include/opendht/sockaddr.h
index 758c27db87392c3d236e0c37f9e5fca2e2b3db12..cb3fb0bf87e38782928819904377fa11c8e4c08f 100644
--- a/include/opendht/sockaddr.h
+++ b/include/opendht/sockaddr.h
@@ -74,7 +74,7 @@ public:
      * first 64 bits in IPv6.
      */
     struct ipCmp {
-        bool operator()(const SockAddr& a, const SockAddr& b) {
+        bool operator()(const SockAddr& a, const SockAddr& b) const {
             if (a.second != b.second)
                 return a.second < b.second;
             socklen_t start, len;