diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 05f5900edc33e31a89d89e5fd12eb9a96a9f1a1b..b80ca122bdf553ba896745c76ac9e35531bf79fb 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -1268,6 +1268,7 @@ void ClassOrNamespace::NestedClassInstantiator::instantiate(ClassOrNamespace *en
             }
         }
 
+        nestedClassOrNamespaceInstantiation->_parent = enclosingTemplateClassInstantiation;
         instantiate(nestedClassOrNamespace, nestedClassOrNamespaceInstantiation);
 
         enclosingTemplateClassInstantiation->_classOrNamespaces[nestedName] =
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index d87f67195128182840875cacb4f777093cf96609..2b729b254f0b6ab73f0db7d3bd91ea7faade404d 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2233,6 +2233,22 @@ void CppToolsPlugin::test_completion_data()
             "   double val = @\n"
             "}\n"
         ) << _("d.constBegin()->") << (QStringList());
+
+    QTest::newRow("nested_class_in_template_class_QTCREATORBUG-11752") << _(
+            "template <typename T>\n"
+            "struct Temp\n"
+            "{\n"
+            "   struct Nested1 { T t; };\n"
+            "   struct Nested2 { Nested1 n1; };\n"
+            "};\n"
+            "struct Foo { int foo; };\n"
+            "void fun() {\n"
+            "   Temp<Foo>::Nested2 n2;\n"
+            "   @\n"
+            "}\n"
+        ) << _("n2.n1.t.") << (QStringList()
+            << QLatin1String("foo")
+            << QLatin1String("Foo"));
 }
 
 void CppToolsPlugin::test_completion_member_access_operator()