How are Selena gomez and Demi Lovato friends?

Selena Gomez and Demi Lovato were in Barney and Friends when they were little

and became friends through that.