Communication with extraterrestrial intelligence has actually received a fair amount of (theoretical) attention.
If you have seen the film Contact or read the book (by Carl Sagan), you have seen a brief description of what seems to be the best current protocol. The message Sagan describes in the novel seems to follow the pattern of Lincos, a language developed by mathematician Hans Freudenthal. The idea, as you suggest, is to use mathematical language. The Wikipedia entry does a decent job of explaining how the messages would proceed. You may enjoy to know that messages coded in Lincos have actually been sent to space, in 1999 and 2003. Lincos itself was detailed in the book Lincos: Design of a Language for Cosmic Intercourse, Part 1. (Part 2 was never written.)
Let me quote from Wikipedia:
[Lincos] begins with a simple pattern of pulses intended to establish the terminology for natural numbers and basic arithmetic (addition, subtraction, multiplication and division) in base two. The concepts of equality, comparison, variables and constants are also illustrated by a series of examples, and then finally propositional logic, set theory and first-order logic. The next section of the Lincos dictionary establishes vocabulary for describing time, introducing means for measuring durations, referring to moments in time, and talking about past and future events. The third section is perhaps the most complex, and attempts to convey the concepts and language necessary to describe behavior and conversation between individuals. It uses examples to introduce actors speaking to each other, asking questions, disapproving, quoting other people, knowing and wanting things, promising, and playing. Finally, the fourth section describes the concepts and language relating to mass, space, and motion. This last section goes so far as to describe physical features of human beings and of the Solar system.
A few more details of the first two sections are presented in Contact.
For more details of research in these area, see here. The main issue with Lincos is the underlying assumption that the language of mathematics is universal, which can be traced back to the question of whether mathematics is created or discovered. This universality, its "unavoidable character", is somewhat disputed (again, at least theoretically). See for example the book
Conversations on mind, matter, and mathematics. Jean Pierre Changeux, and Alain Connes. Edited and translated by M. B. DeBevoise. Princeton University Press, 1995,
and for another view, the works of Mario Livio, in particular Is God a mathematician?
(Of course, your question is a bit harder, since it does not require than the originator of the message is human. But Lincos is still the most developed protocol and, at least, should give you an idea of the minimum mathematical assumptions that an exchange would require.)
By the way, I think that the message "hello+friend" requires too much knowledge of $B$ background.
– MphLee Apr 27 '13 at 21:35