How to use editor classes from within an actor class

So, this fixes the compilation error building the editor, but then if you add UnrealEd to your build.cs file you get errors when compiling non-editor builds like “Development”. is there another solution?