fix build
diff --git a/include/json/value.h b/include/json/value.h
index 5f65443..8657e6c 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -50,6 +50,9 @@
 #include <string>
 #include <vector>
 
+// Forward declaration for testing.
+struct ValueTest;
+
 #ifdef JSONCPP_HAS_STRING_VIEW
 #include <string_view>
 #endif
@@ -201,6 +204,7 @@
  */
 class JSON_API Value {
   friend class ValueIteratorBase;
+  friend struct ::ValueTest;
 
 public:
   using Members = std::vector<String>;
diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp
index 640c7a2..74f7789 100644
--- a/src/lib_json/json_value.cpp
+++ b/src/lib_json/json_value.cpp
@@ -301,6 +301,9 @@
 }
 
 Value::CZString& Value::CZString::operator=(CZString&& other) noexcept {
+  if (cstr_ && storage_.policy_ == duplicate) {
+    releasePrefixedStringValue(const_cast<char*>(cstr_));
+  }
   cstr_ = other.cstr_;
   if (other.cstr_) {
     storage_.policy_ = other.storage_.policy_;