You have to love Peter, he was the one that would say the things you didn’t have the nerve too. Jesus is teaching about wealthy people will having a hard time getting into heaven, Peter then says well how can anyone be saved and proceeds to tell Jesus we have given up everything for you.
Salvation is free because Jesus paid for that, but to follow Christ will cost you! Jesus even encourages them by telling them that if anyone gives up mothers, brothers, etc for him they will be rewarded for it. Everyone will not be your friend when you make a stand for Christ you might lose a lot, but you will please the one who called you.