diff --git a/contrib/foreach.hpp b/contrib/foreach.hpp
index 319807771c1c5eee03e45da1a72099a8860422ef..c42315194aeb9a5aefc7d1b6058592d379e7609b 100644
--- a/contrib/foreach.hpp
+++ b/contrib/foreach.hpp
@@ -7,6 +7,8 @@
 #ifndef HEADER_PUGIXML_FOREACH_HPP
 #define HEADER_PUGIXML_FOREACH_HPP
 
+#include <boost/range/iterator.hpp>
+
 #include "pugixml.hpp"
 
 /*
@@ -17,9 +19,6 @@
 
 namespace boost
 {
-	template <typename> struct range_mutable_iterator;
-	template <typename> struct range_const_iterator;
-
 	template<> struct range_mutable_iterator<pugi::xml_node>
 	{
 		typedef pugi::xml_node::iterator type;
@@ -52,12 +51,12 @@ namespace pugi
 {
 	inline xml_object_range<xml_node_iterator> children(const pugi::xml_node& node)
 	{
-        return node.children();
+		return node.children();
 	}
 
 	inline xml_object_range<xml_attribute_iterator> attributes(const pugi::xml_node& node)
 	{
-        return node.attributes();
+		return node.attributes();
 	}
 }