I have been programming in C++ for quite some time and I never thought about this until today.
Consider the following code:
struct foo { // compiles fi
It has a lot to do with visibility. I think your confusion may come from assuming a single pass. Think of class parsing as done in two stages.
The advantage to this is we have visibility of the entire class from within class member functions.