What's the proper way to add an editor-only component?

So here’s the declaration of my component:

  #if WITH_EDITOR
    	UPROPERTY(VisibleDefaultsOnly)
    	class UBoxComponent* EditorCourtBounds;
    #endif

And in the constructor I create it like so:

#if WITH_EDITOR
	EditorCourtBounds = CreateEditorOnlyDefaultSubobject<UBoxComponent>(TEXT("EditorCourtBounds"));
#endif

And the error I get is:

HalfCourt.h(29): error C2039: 'EditorCourtBounds': is not a member of 'AHalfCourt'
HalfCourt.h(27): note: see declaration of 'AHalfCourt'
HalfCourt.h(29): error C2618: illegal member designator in offsetof
HalfCourt.h(29): note: offsetof has a builtin meaning; use /Zc:offsetof- to revert to old, non-conforming definition

Where line 29 is the GENERATED_BODY() macro and line 27 is the class declaration.