Step 1: Always eat ahead
Step 2: Bring a safe snack
When I bring a snack to a friend's house, I always make sure to set some aside to keep it cross-contamination free. Then I put the platter out to share. That way, if someone eats something I am allergic to, then touches the brownies I brought, I don't have to worry that I can't eat them. I know I have some set aside just for me.