I’m getting the same issue, you can get it to working by including a header from Engine. But it feels like a work around because its finicky. I opened an issue also. I am surprised more people are not encountering this.
Edit:
If you Generate the Visual Studio files from right clicking the Unreal Project file it will also correct the issue without any weird stuff happening