Thank you for your email. I understand how you would like everyone to get on.
Your son is still very young and does not understand about sharing his toys, considering another child's needs (empathy). He also has not had much experience interacting with other children.He may also feel angry at having to share you with other people and is expressing his anger through slapping and biting.When your friend's daughter visits you need to supervise the children carefully so you can teach your son about empathy. Tell him that smacking and biting makes people sad and that you don't smack or bite in your house. He doesn't understand about sharing toys yet so try to initiate games and manage games with them that don't involve toys.
Also explain to her the differences between two and four year olds so she has some understanding of why he does the things he does. Being an only child she also needs guidance on how to get along with other children and she may also be feeling angry at having to share her dad with others.
If you and your friend can supervise and direct the children's play they will learn how to get along, as in all families. I would not recommend leaving them to 'sort themselves out'. As a general rule I would recommend that you teach your child about getting along and your friend guides his daughter .
If you feel this relationship is permanent, you both need to begin building trusting relationships with each other's children before stepping into a parenting role with them.
Your children will always be a part of your new relationship and you need to negotiate a plan for your blended family that you both are excited about moving forward. It is important to discuss parenting styles and values now before you live together so that you are consistent with the children, and then you won't feel that the children are 'coming between' you as you will be in agreement on how to parent them.
Good luck! Let me know how you are all doing.