diff --git a/CppHeaderParser/CppHeaderParser.py b/CppHeaderParser/CppHeaderParser.py
index 56739b0..7b07900 100644
--- a/CppHeaderParser/CppHeaderParser.py
+++ b/CppHeaderParser/CppHeaderParser.py
@@ -1685,7 +1685,7 @@ class Resolver(object):
 
                     elif nestedTypedef:
                         var["fundamental"] = is_fundamental(nestedTypedef)
-                        if not var["fundamental"]:
+                        if not var["fundamental"] and "method" in var:
                             var["raw_type"] = var["method"]["path"] + "::" + tag
 
                     else:

diff --git a/test/test_CppHeaderParser.py b/test/test_CppHeaderParser.py
index d23cb23..a876d87 100644
--- a/test/test_CppHeaderParser.py
+++ b/test/test_CppHeaderParser.py
@@ -3838,5 +3838,35 @@ class A : public B<int, int>::C {};
         )
 
 
+class NestedTypedef(unittest.TestCase):
+    def setUp(self):
+        self.cppHeader = CppHeaderParser.CppHeader(
+            """
+template <class SomeType> class A {
+ public:
+  typedef B <SomeType> C;
+  
+  A();
+
+ protected:
+  C aCInstance;
+};
+""",
+            "string",
+        )
+
+    def test_fn(self):
+        c = self.cppHeader.classes["A"]
+        self.assertEqual("A", c["name"])
+
+        self.assertEqual(0, len(c["properties"]["public"]))
+        self.assertEqual(1, len(c["properties"]["protected"]))
+        self.assertEqual(0, len(c["properties"]["private"]))
+
+        c = c["properties"]["protected"][0]
+        self.assertEqual(c["name"], "aCInstance")
+        self.assertEqual(c["type"], "C")
+
+
 if __name__ == "__main__":
     unittest.main()

Regression in 4.0.0
The following code works on 3.3.0 release but fails from 4.0.0 and later:

```python
import CppHeaderParser

h = """
template <class SomeType> class A {
 public:
  typedef B <SomeType> C;
  
  A();

 protected:
  C aCInstance;
};

"""
a = CppHeaderParser.CppHeader(h, "string")
print(a)
```

The error message is the following:
```bash
Traceback (most recent call last):
  File "ess.py", line 15, in <module>
    a = CppHeaderParser.CppHeader(h, "string")
  File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 2981, in __init__
    self.finalize()
  File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 1918, in finalize
    self.finalize_vars()
  File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 1664, in finalize_vars
    var["raw_type"] = var["method"]["path"] + "::" + tag
KeyError: 'method'
```

Note that the issue comes from the last line ```C aCInstance;```. If type is changed to something else but C, string is parse correctly.

ping @rainman110


test/test_CppHeaderParser.py::NestedTypedef::test_fn
test/test_CppHeaderParser.py::functions_TestCase::test_function_name_1 test/test_CppHeaderParser.py::functions_TestCase::test_function_name_2 test/test_CppHeaderParser.py::functions_TestCase::test_num_functions test/test_CppHeaderParser.py::functions2_TestCase::test_function_name_1 test/test_CppHeaderParser.py::functions2_TestCase::test_function_name_2 test/test_CppHeaderParser.py::functions2_TestCase::test_num_functions test/test_CppHeaderParser.py::Macro_TestCase::test_includes test/test_CppHeaderParser.py::Macro_TestCase::test_pragmas test/test_CppHeaderParser.py::Macro_TestCase::test_pragmas0 test/test_CppHeaderParser.py::Macro_TestCase::test_pragmas1 test/test_CppHeaderParser.py::Macro_TestCase::test_pragmas2 test/test_CppHeaderParser.py::FilterMagicMacro_TestCase::test_line_num_is_correct test/test_CppHeaderParser.py::FilterMagicMacro_TestCase::test_method_exists test/test_CppHeaderParser.py::LineNumAfterDivide_TestCase::test_line_num test/test_CppHeaderParser.py::JSON_TestCase::test_hasLemon test/test_CppHeaderParser.py::HALControlWord_TestCase::test_classes test/test_CppHeaderParser.py::HALControlWord_TestCase::test_functions test/test_CppHeaderParser.py::HALControlWord_TestCase::test_num_typedefs test/test_CppHeaderParser.py::CommentEOF_TestCase::test_comment test/test_CppHeaderParser.py::UsingNamespace_TestCase::test_class test/test_CppHeaderParser.py::UsingNamespace_TestCase::test_fn test/test_CppHeaderParser.py::UsingNamespace_TestCase::test_using test/test_CppHeaderParser.py::StaticFn_TestCase::test_fn test/test_CppHeaderParser.py::ConstExpr_TestCase::test_fn test/test_CppHeaderParser.py::DefaultEnum_TestCase::test_fn test/test_CppHeaderParser.py::MultiFile_TestCase::test_fn test/test_CppHeaderParser.py::TemplateMadness_TestCase::testBuildIndexImpl1 test/test_CppHeaderParser.py::TemplateMadness_TestCase::testBuildIndexImpl2 test/test_CppHeaderParser.py::TemplateMadness_TestCase::testConcatIterator test/test_CppHeaderParser.py::TemplateMadness_TestCase::testS test/test_CppHeaderParser.py::TemplateMadness_TestCase::testXYZ test/test_CppHeaderParser.py::Attributes_TestCase::test_existance test/test_CppHeaderParser.py::EnumWithTemplates_TestCase::test_values test/test_CppHeaderParser.py::FreeTemplates_TestCase::test_fn test/test_CppHeaderParser.py::MessedUpDoxygen_TestCase::test_cls test/test_CppHeaderParser.py::MessedUpDoxygen_TestCase::test_cls2 test/test_CppHeaderParser.py::MessedUpDoxygen_TestCase::test_fn test/test_CppHeaderParser.py::MessedUpDoxygen_TestCase::test_var1 test/test_CppHeaderParser.py::MessedUpDoxygen_TestCase::test_var2 test/test_CppHeaderParser.py::EnumParameter_TestCase::test_enum_param test/test_CppHeaderParser.py::EnumParameter_TestCase::test_enum_retval test/test_CppHeaderParser.py::StaticAssert_TestCase::test_nothing test/test_CppHeaderParser.py::InitializerWithInitializerList_TestCase::test_cls_props test/test_CppHeaderParser.py::InitializerWithInitializerList_TestCase::test_future test/test_CppHeaderParser.py::EnumClass_TestCase::test_enum test/test_CppHeaderParser.py::NestedResolving_TestCase::test_nothing test/test_CppHeaderParser.py::EnumCrash_TestCase::test_nothing test/test_CppHeaderParser.py::ExternInline_TestCase::test_fn test/test_CppHeaderParser.py::PointerTemplate_TestCase::test_fn test/test_CppHeaderParser.py::ParamWithInitializer_TestCase::test_fn test/test_CppHeaderParser.py::NestedClassAccess_TestCase::test_fn test/test_CppHeaderParser.py::AnonUnion_TestCase::test_fn test/test_CppHeaderParser.py::Deleted_TestCase::test_fn test/test_CppHeaderParser.py::BaseTemplateNs_TestCase::test_fn