How to access data in a forward declared object in a method parameter?

I have a Puzzle class that has a IsSolutionCorrect() method that takes in a struct Input *input. In this method I want to print one of the input devices it holds, in this case bool switchOne. I don’t know exactly how to do that. The compile says error C2027: use of undefined type 'Input' and I don’t know why it says that.

// Puzzle.cpp
bool Puzzle::IsSolutionCorrect(struct Input *input){

	UE_LOG(LogTemp, Log, TEXT("Switch one: %d"), input->switchOne); //Compiler error

	return false;
}

Its working now that I included the proper headers. That has me a little confused. I thought the purpose of using forward declaration in method parameters is so that you didn’t have to paste headers everywhere an risk a redefinition error.

My Puzzle class is defined as such without the headers and compiles without Instruments.h and Input.h
// Puzzle.h
class Puzzle{
protected:
int id;
public:
int GetID(){return id;}
bool IsSolutionCorrect(class Instruments *inst, struct Input *input);
};

I’m guessing it has to do with the compiler needing to know what’s in those objects if I’m trying to invoke something like in my Puzzle.cpp. I just compiled Puzzle.cpp with the headers and without forward declaration which compiled fine. Its starting to make sense. I thought at first things wouldn’t compile correctly unless the method parameters in the source perfectly mirrored its definition.

You cannot access data in a forward declared class until the class is actually declared.
So you only need a forward declaration for Input to declare Puzzle::IsSolutionCorrect but the full class declaration to define IsSolutionCorrect’s function body.

Good practice is to use forward declarations in your header files and then include the header with the full class declaration at the top of your cpp file.