add forwarding references to json_ref constructor
fixes #805

One funny thing I've discovered: You cannot use `friend void to_json()` with a local class (class/struct defined inside a function). I'll investigate later, I remember seeing something in the standard about that.

Anyway it's not a very asked feature :) 
{"label": "nlohmann:develop", "ref": "develop", "sha": "8e067c0c3c8739912e24035e9656df9aa973bb9d"}
Just a little annoyance I encountered while writing to_json functions for a large number of in house classes.  Ideally I'd like it if the {} operator behaved the same as the = operator.

Given the following code:
```cpp
using json = nlohmann::json;

class A {
private:
	std::string          _val;

	// by including the mutex we've implicitly deleted our copy constructor 
	std::recursive_mutex _mutex;

public:
	A() : _val("Hello World") {};

	friend void to_json(json &j, const A &a) {
		j = {
			{"val", a._val}
		};
	}
};



int main(int argc, char* argv[]) {

	json j = {};
	A a;

        // This line compiles and runs completely fine.
        j["data"]["A"] =  a;

        //this line will fail to compile, due to the implicitly deleted A::A(const A&)
	j["data"] = {{"A", a}};
	
        std::cout << j.dump() << std::endl;
	return 0;
}
```


{} uses copy constructor, while = does not
diff --git a/src/json.hpp b/src/json.hpp
index 5c6515bf6d..e8941302d7 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -6789,7 +6789,7 @@ class json_ref
     {}
 
     template <class... Args>
-    json_ref(Args... args)
+    json_ref(Args&&... args)
         : owned_value(std::forward<Args>(args)...),
           value_ref(&owned_value),
           is_rvalue(true)

diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp
index 1e1588e603..edd03b9cd8 100644
--- a/test/src/unit-regression.cpp
+++ b/test/src/unit-regression.cpp
@@ -36,6 +36,22 @@ using nlohmann::json;
 #include <list>
 #include <cstdio>
 
+namespace
+{
+  struct nocopy
+  {
+    nocopy() = default;
+    nocopy(const nocopy &) = delete;
+
+    int val = 0;
+
+    friend void to_json(json& j, const nocopy& n)
+    {
+      j = {{"val", n.val}};
+    }
+  };
+}
+
 TEST_CASE("regression tests")
 {
     SECTION("issue #60 - Double quotation mark is not parsed correctly")
@@ -1282,4 +1298,12 @@ TEST_CASE("regression tests")
             }
         }
     */
+
+    SECTION("issue #805 - copy constructor is used with std::initializer_list constructor.")
+    {
+      nocopy n;
+      json j;
+      j = {{"nocopy", n}};
+      CHECK(j["nocopy"]["val"] == 0);
+    }
 }

{"test-json_pointer_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-regression_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-modifiers_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-reference_access_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-comparison_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_lexer_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_const_iterator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterator_wrapper_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_iterator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-udt_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_const_iterator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-cbor_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-allocator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-inspection_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-algorithms_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-testsuites_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-comparison_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterator_wrapper_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-meta_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-allocator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-readme_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-concepts_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-unicode_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-pointer_access_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-serialization_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-msgpack_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-msgpack_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-regression_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-convenience_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-conversions_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_parser_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-readme_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-noexcept_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-inspection_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_iterator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-algorithms_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-unicode_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-conversions_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-noexcept_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-concepts_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-pointer_access_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-cbor_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-modifiers_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_patch_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-capacity_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-serialization_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-testsuites_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-udt_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-reference_access_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_lexer_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-capacity_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_patch_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_parser_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_pointer_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-deserialization_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-convenience_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-meta_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-deserialization_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"test-json_pointer_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-regression_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-modifiers_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-reference_access_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-comparison_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_lexer_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_const_iterator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterator_wrapper_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_iterator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-udt_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_const_iterator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-cbor_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-allocator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-inspection_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-algorithms_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-testsuites_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-comparison_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterator_wrapper_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-meta_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-allocator_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-readme_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-concepts_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-unicode_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-pointer_access_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-serialization_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-msgpack_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-msgpack_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-regression_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-convenience_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-conversions_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_parser_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-readme_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-noexcept_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-inspection_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_iterator_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-algorithms_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-unicode_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-conversions_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-noexcept_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-concepts_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-pointer_access_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators1_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-constructor1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-cbor_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-modifiers_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_patch_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-capacity_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-element_access2_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-serialization_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-testsuites_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators1_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-udt_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-reference_access_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_lexer_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-capacity_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_patch_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-class_parser_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-json_pointer_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-iterators2_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-deserialization_all": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-convenience_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-meta_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test-deserialization_default": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 70, "failed_count": 0, "skipped_count": 0, "passed_tests": ["test-json_pointer_default", "test-regression_all", "test-element_access2_default", "test-convenience_all", "test-modifiers_all", "test-conversions_default", "test-class_parser_default", "test-constructor1_all", "test-reference_access_default", "test-element_access1_all", "test-readme_default", "test-comparison_default", "test-noexcept_default", "test-class_lexer_default", "test-class_const_iterator_all", "test-element_access1_default", "test-inspection_default", "test-iterator_wrapper_default", "test-class_iterator_all", "test-class_iterator_default", "test-algorithms_default", "test-unicode_all", "test-udt_all", "test-class_const_iterator_default", "test-constructor2_default", "test-cbor_all", "test-allocator_default", "test-concepts_default", "test-conversions_all", "test-noexcept_all", "test-iterators2_all", "test-inspection_all", "test-algorithms_all", "test-pointer_access_all", "test-iterators1_all", "test-testsuites_default", "test-comparison_all", "test-constructor1_default", "test-cbor_default", "test-modifiers_default", "test-json_patch_all", "test-capacity_all", "test-iterator_wrapper_all", "test-constructor2_all", "test-element_access2_all", "test-serialization_default", "test-testsuites_all", "test-meta_all", "test-allocator_all", "test-iterators1_default", "test-udt_default", "test-reference_access_all", "test-class_lexer_all", "test-capacity_default", "test-json_patch_default", "test-class_parser_all", "test-json_pointer_all", "test-readme_all", "test-iterators2_default", "test-concepts_all", "test-unicode_default", "test-pointer_access_default", "test-serialization_all", "test-deserialization_all", "test-msgpack_default", "test-msgpack_all", "test-regression_default", "test-convenience_default", "test-meta_default", "test-deserialization_default"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 70, "failed_count": 0, "skipped_count": 0, "passed_tests": ["test-json_pointer_default", "test-regression_all", "test-element_access2_default", "test-convenience_all", "test-modifiers_all", "test-conversions_default", "test-class_parser_default", "test-constructor1_all", "test-reference_access_default", "test-element_access1_all", "test-readme_default", "test-comparison_default", "test-noexcept_default", "test-class_lexer_default", "test-class_const_iterator_all", "test-element_access1_default", "test-inspection_default", "test-iterator_wrapper_default", "test-class_iterator_all", "test-class_iterator_default", "test-algorithms_default", "test-unicode_all", "test-udt_all", "test-class_const_iterator_default", "test-constructor2_default", "test-cbor_all", "test-allocator_default", "test-concepts_default", "test-conversions_all", "test-noexcept_all", "test-iterators2_all", "test-inspection_all", "test-algorithms_all", "test-pointer_access_all", "test-iterators1_all", "test-testsuites_default", "test-comparison_all", "test-constructor1_default", "test-cbor_default", "test-modifiers_default", "test-json_patch_all", "test-capacity_all", "test-iterator_wrapper_all", "test-constructor2_all", "test-element_access2_all", "test-serialization_default", "test-testsuites_all", "test-meta_all", "test-allocator_all", "test-iterators1_default", "test-udt_default", "test-reference_access_all", "test-class_lexer_all", "test-capacity_default", "test-json_patch_default", "test-class_parser_all", "test-json_pointer_all", "test-readme_all", "test-iterators2_default", "test-concepts_all", "test-unicode_default", "test-pointer_access_default", "test-serialization_all", "test-deserialization_all", "test-msgpack_default", "test-msgpack_all", "test-regression_default", "test-convenience_default", "test-meta_default", "test-deserialization_default"], "failed_tests": [], "skipped_tests": []}