What are the steps to make an already-written basic C++ class into a BlueprintType?

Often I’ll write a class in C++, then much later find that I want it available to an event graph as a type. So I need to make my class a BlueprintType.

  • Can this be done by just editing the code? If so, what are the exact changes required? I’ve added a basic example below of what I tried. Unfortunately most Google results work from the other direction.
  • If not possible via code changes alone, what’s the typical way to do it?

Dummy example .H:

#pragma once
#include "CoreMinimal.h"

class UDummy { public:
    UDummy() { PrintAThing(); };
    void PrintAThing() const; 
};

Dummy example .CPP:

#include "dummy.h"
void UDummy::PrintAThing() const {  UE_LOG(LogTemp, Warning, TEXT("A thing!")); }

I’ve tried adding in these changes to the header file, but if the code is saved with these changes it just repeatedly crashes the UE editor on startup until I undo them:

#include "Dummy.generated.h"

UCLASS(BlueprintType)
class UDummy : public UObject
{
    GENERATED_BODY()

The only alternative I know otherwise is to rename the C+ files, create a new BP class with the original class name, then copy and paste code into the new BP Class’s source files.