diff --git a/src/json.hpp b/src/json.hpp
index 61b18f10..993d12e2 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -5702,7 +5702,7 @@ class basic_json
         /// the container to iterate
         basic_json& container;
         /// the type of the iterator to use while iteration
-        using json_iterator = decltype(container.begin());
+        using json_iterator = decltype(std::begin(container));
 
         /// internal iterator wrapper
         class iterator_wrapper_internal
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index 2f01c007..8c24f58e 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -5702,7 +5702,7 @@ class basic_json
         /// the container to iterate
         basic_json& container;
         /// the type of the iterator to use while iteration
-        using json_iterator = decltype(container.begin());
+        using json_iterator = decltype(std::begin(container));
 
         /// internal iterator wrapper
         class iterator_wrapper_internal