Waiting is not something children find easy. They often interrupt when they have a need and may not always be aware that this is a problem. This is because as parents we are often immediately responsive to our children. Thus children don't always recognise that interrupting us, when we are talking to someone else or fully engaged in an activity, is wrong.
Put your hand on their shoulder, showing that you recognise that they are there but try to avoid making eye-contact. Make your child wait for a short while before turning to them. Gradually extend the time they wait from a few seconds to a minute or more.
Put them on hold
Acknowledge them with the same short script each time. E.g. 'Thanks for waiting.' and then turn away. Immediately ask your friend if it is OK if you quickly deal with your child. Very gradually extend the time that your child waits before you interrupt your conversation.
Avoid using time dependent waiting statements e.g ' Will be with you in minute.' Time is difficult for children to measure and they perceive it passing more slowly than adults. Instead it is better to say something that is more open ended. For example:
'I will be with you soon, thank you for waiting quietly.'