diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 45a3d3cd2893dceb6bd36c1fd61cef22d2f130f8..3012349047d412b38b657f2a260339267f457014 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -4782,7 +4782,7 @@ public:
 /// this should get its own sugar class to better represent the source.
 class ObjCObjectType : public Type,
                        public ObjCProtocolQualifiers<ObjCObjectType> {
-  friend class ObjCProtocolQualifiers;
+  template <class T> friend class ObjCProtocolQualifiers;
   // ObjCObjectType.NumTypeArgs - the number of type arguments stored
   // after the ObjCObjectPointerType node.
   // ObjCObjectType.NumProtocols - the number of protocols stored