I’m late to the party but found a solution without copy/pasta or manually modifying my build file.
In the Unreal editor add a new C++ class and have it inherit from CustomMeshComponent. That will add your new class to the Visual Studio solution. You can now ignore/delete that class if you want, since adding it has properly included the CustomMeshComponent files into your external dependencies. Now you can include CustomMeshComponent.h to any class you want without errors about not finding/linking the files.