class forward declaration fails
<p>I have 2 header files and a source file,</p>

<p>food.h:</p>

<pre><code>#ifndef _FOOD_H
#define _FOOD_H

struct food {
    char name[10];
};

#endif
</code></pre>

<p>dog.h:</p>

<pre><code>#ifndef _DOG_H
#define _DOG_H

class food;  //forward declaration

class Dog {
public:
    Dog(food f);

private:
    food _f;
};

#endif
</code></pre>

<p>And here is the source file of <code>class dog</code>,</p>

<pre><code>//dog.cpp
#include "dog.h"
#include "food.h"

Dog::Dog(food f) : _f(f)
{}
</code></pre>

<p>The problem is I can compile the above code, I got an error saying <code>_f has incomplete type</code>.</p>

<p>I thought I can put a forward declaration in <code>dog.h</code> and include <code>food.h</code> in <code>dog.cpp</code>, but it doesn't work, why? And I shouldn't put user defined header file in <code>.h</code> files, right? It's deprecated, isn't it?</p>
