which with the code below causes a crash and printing out the integer value passed into the method is different to the 55 sent in

Packet packet;

int intVal = 55;

packet << intVal ;

Now that I am writing this I think it is because i tried to set this up as a angelscript value type. Because packet is actually from the sfml library and I do not really want to be adding reference counting to that class and I was happy with a copy being made when used in scripts. Here is the setup of the type. Though I still can not understand why the function call can output text and print out the passed in integer except incorrectly. I thought that would be the only thing that works and the invalid pointer for the packet or what ever would be the only issue(and probably is the reason it does crash).