You need to implement the push notification services, in your own application. If the phone A and B are on the same device-type; Android, iOS etc. Then you can easily configure the services such as Firebase for Android etc. However, if the platforms are different, then instead of implementing these on every device, you can easily configure Azure Notification Hub to send and receive the messages, where you can pass the keys for your Firebase and other services for push notifications.
I wrote an answer to a similar question previously, please read that answer here:
How to implement push notifications[
^]