title: Forward class as super class
body: <p>I am trying to do a static library, which uses AFNetworking. I want to distribute the library only with .a and .h files. </p>
  
  <p>However, one of my classes within the library is a subclass of <code>AFHTTPSessionManager</code>. So my previous .h file looked like this:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import "AFNetworking.h"
  
  @interface MyClass : AFHTTPSessionManager
  
  + (MyClass *) sharedInstance;
  
  - (void) doMagic;
  
  @end
  </code></pre>
  
  <p>When I compiled the library and imported the .a and .h files into a new test project I got an error <strong>"Lexical or Preprocessor Issue 'AFNetworking.h' file not found"</strong>. Thought that the solution would be to use forward class declaration and move the #import "AFNetworking.h" to the .m file like this:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @class AFHTTPSessionManager;
  
  @interface MyClass : AFHTTPSessionManager
  
  + (MyClass *) sharedInstance;
  
  - (void) doMagic;
  
  @end
  </code></pre>
  
  <p>Unfortunately, this approach throws an error <strong>"Attempting to use forward class 'AFHTTPSessionManager' as superclass of 'MyClass'"</strong>. 
  As far as I understand forward class declaration you use it just to say <em>"hey compiler classXXX exists, but you cannot see its methods and properties"</em>. Therefore, I am not sure if that's the solution to my problem. </p>
  
  <p>Any suggestion how to subclass from a class but not import it?</p>