It is not against the rules to play with a friend, but it is against the rules (or at least used to be) to ally with a player before you enter a game. I've played a few games with real life friends and it's a lot of fun, but we never explicitly agree to ally before anything starts. Sometimes we end up working together, but other times we team up with strangers and work against each other. I never play rated games with friends though, as a lot of people see that as multi boxing. In your situation, that's basically a predetermined alliance, which used to be mentioned somewhere as against the rules.
"You want to believe that there’s one relationship in life that’s beyond betrayal. A relationship that’s beyond that kind of hurt. And there isn’t."
-Caleb Carr