Overload operator << to put custom struct in TArray

Hi,

I added this code to be able to use the struct in TArray of FGridData :

friend FArchive& operator<<(FArchive& Ar, FGridData& gridData)
{
	Ar << static_cast<uint8>(gridData.value_);
	return Ar;
}

I have the following error

Error: error C2679: binary ‘<<’ : no operator found which takes a right-hand operand of type ‘uint8’ (or there is no acceptable conversion)

So, I just changed for this code, passing by a temp variable and it works well :

friend FArchive& operator<<(FArchive& Ar, FGridData& gridData)
{
	uint8 value = static_cast<uint8>(gridData.value_);
	Ar << value;
	return Ar;
}

Can somebody explain me this ? The overloaded << (FArchive&, uint8&) takes a reference to the uint8. Maybe is it impossible to get a reference with a static_cast ?

Thank you!