diff --git a/interpreter/cling/lib/Interpreter/Interpreter.cpp b/interpreter/cling/lib/Interpreter/Interpreter.cpp
index dbce6c9434b48c4137fce40c3c60f9e59f6227cf..759fa3e68b4ab6e6361eb5b920757724deab6703 100644
--- a/interpreter/cling/lib/Interpreter/Interpreter.cpp
+++ b/interpreter/cling/lib/Interpreter/Interpreter.cpp
@@ -681,8 +681,8 @@ namespace cling {
     cling::valuePrinterInternal::declarePrintValue(*this);
     std::string ret;
     std::stringstream ss;
-    ss << "*((std::string*)" << &ret << ") = cling::printValue((" << type << "*)"
-       << obj << ");";
+    ss << "*((std::string*)" << std::hex << std::showbase << (size_t)&ret << ") = cling::printValue((" << type << "*)"
+       << std::hex << std::showbase << (size_t)obj << ");";
     CompilationResult result = process(ss.str().c_str());
     if (result != cling::Interpreter::kSuccess)
       llvm::errs() << "Error in Interpreter::toString: the input " << ss.str()