Cannot overload operator: 'operator <<' is ambiguous

I’m trying to overload the << operator, as per Rama’s wiki tutorial about binary saving, so that I can save a custom object to binary.

I have created a separate header file for operator overloading called FileOperators.h which contains this:

FORCEINLINE FArchive& operator<<(FArchive& Ar, USettings* Settings)
{
	if (!Settings) return Ar;

	Ar << Settings->ObjectClass;

	return Ar;
}

So it should save the ObjectClass parameter (UClass*) to binary. And I have created a function trying to use that (I’m only putting the relavant line in here)

void UFileSystem::SaveLoadData(FArchive& Ar, USettings* Settings)
{
	Ar << Settings;
}

When I try to compile, I get the error: ‘operator <<’ is ambiguous

If I mouse over the << operator, it tells me why:

more than one operator "<<" matches these operands:
function "operator<<(FArchive &Ar, USettings *&Res)"
function "operator<<(FArchive &Ar, USettings *Settings)"
oparand types are: FArchive << USettings*

What am I doing wrong? I can’t see that I’m doing anything differently from Rama’s code…

I figure it out.

The operator override needed to be

USettings& Settings

not

USettings* Settings

And the use of the operator needed to be:

Ar << *Settings

not

Ar << Settings