title: Why is a forward declaration in a function declaration allowed?
body: <p>While reading about the visitor pattern I ran into this snippet of code:</p>
  
  <pre><code>virtual void visit(class Composite *, Component*) = 0;
  </code></pre>
  
  <p>This is a member function, and it seems to be forward declaring the class <code>Composite</code> inside its parameters. I tried this with just a normal function, like so:</p>
  
  <pre><code>void accept(class A a);
  </code></pre>
  
  <p>for some class <code>A</code> that I haven't declared or defined yet and the code worked fine. Why is this allowed? How, if at all, is it different from forward declaring before the line? Has anything changed recently in the standard in regards to this?</p>
  
  <hr>
  
  <p>Many people are claiming this is a leftover of C, but then why does this code compile fine in C++, but not C?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int process(struct A a);
  
  struct A{
      int x;
  };
  
  int process(struct A a){
      return a.x;
  }
  
  int main(void)
  {
      struct A a = {2};
      printf("%d", process(a));
      return 0;
  }
  </code></pre>