Cannot cast from AController to APlayerController

I have a custom character movement component which has compiled just fine for a long time.
I have this line of code in there somewhere:

if (APlayerController* controller = Cast<APlayerController>(character->GetController()))

Then I go ahead and do a change, totally unrelated to the above line. In fact, I tried just to add a space somewhere to make the .cpp dirty. Trying to compile afterwards gives this error:

C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\CoreUObject\Public\Templates/Casts.h(193): error C2664: 'APlayerController *TCastImpl<From,To,ECastType::FromCastFlags>::DoCast(UObject *)': cannot convert argument 1 from 'AController *' to 'UObject *'
             with
             [
                 From=AController,
                 To=APlayerController
             ]
     C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\CoreUObject\Public\Templates/Casts.h(193): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
     C:\GameDev\mesterKG_lightspark\VoCM\Source\VoCM\Private\Components\CharacterMovement\VocmCharacterMovementComponent.cpp(181): note: see reference to function template instantiation 'To *Cast<APlayerController,AController>(From *)' being compiled
             with
             [
                 To=APlayerController,
                 From=AController
             ]

Weird, uh?

I’m on 4.20.1, using VS Pro 2017 v15.7.6. I’ve tried to clean solution, removed .vs, binaries, intermediate and saved folders and regenerated the project files.

If I revert the changes in the .cpp file, it compiles again without error… insert single space and it breaks again…

What can I do?

EDIT: I tried to reproduce this with an new project and I could not. The casting works fine there. So something is wrong with my project… if only I could figure out what.

So I found the cause… I had not included the PlayerController.h in my component. So for some reason, this worked fine for a long time, but not anymore. With the include added, no compile issues.