Having difficulty getting FObjectReader to work

I was able to write an object onto a TArray<uint8> as follows:

UMyObj* x = NewObject<UMyObj>();
TArray<uint8> objData;
FObjectWriter writer(objData);
writer << x;

But I’m having difficulty reading it back out. I tried both constructors given on the official documentation, but neither seem to work. FObjectReader reader(objData); doesn’t even compile; says “error C2248: ‘FObjectReader::FObjectReader’: cannot access protected member declared in class ‘FObjectReader’”. And the other constructor freezes my editor:

UMyObj* y = NewObject<UMyObj>();
FObjectReader reader(y, objData);

There’s shouldn’t be anything in UMyObj that’s causing this error. It currently extends UObject and has no fields:

class SCRATCH_API UMyObj : public UObject { GENERATED_BODY() };