title: C++11 class in std::map as Value with private constructors
body: <p>Here is the simplified version of the class which is stored as value in a map which works fine in VS2008 (note that <strong>all</strong> members are private):</p>
  
  <pre><code>class Value{
      friend class FriendClass;
      friend class std::map&lt;std::string, Value&gt;;
      friend struct std::pair&lt;const std::string, Value&gt;;
      friend struct std::pair&lt;std::string, Value&gt;;
  
      Value() {..}
      Value(Value const&amp; other) {..}
  
      ... rest members...
  };
  </code></pre>
  
  <p>Code (called from FriendClass, so this can reach private constructors) :</p>
  
  <pre><code>FriendClass::func()
  {
      std::map&lt;const std::string, Value&gt; map;
      map.insert(std::make_pair(std::string("x"), Value()));
  }
  </code></pre>
  
  <p>This compiles w/o any error in VS2008, but fails on VS2015/C++11:</p>
  
  <pre>
  file.cpp(178): error C2664: 'std::_Tree_iterator>>> std::_Tree>::insert(std::_Tree_const_iterator>>>,const std::pair &)': cannot convert argument 1 from 'std::pair' to 'std::pair &&'
        with
        [
            _Kty=std::string,
            _Ty=Value,
            _Pr=std::less,
            _Alloc=std::allocator>
        ]
        and
        [
            _Kty=std::string,
            _Ty=Value
        ]
    file.cpp(178): note: Reason: cannot convert from 'std::pair' to 'std::pair'
        with
        [
            _Kty=std::string,
            _Ty=Value
        ]
    file.cpp(178): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
  </pre>
  
  <p>If I make the Value copy constructor public, it compiles fine in VS2015 as well. <br> <br> But that was private with purpose, and only made available for std::map and std::pair. However, it seems in C++11 additional friend access are also necessary to declare. Which are these?</p>
  
  <p>Thank you.</p>