In order to get both the Rival and Friend achievements, make one companion a rival or friend, and then make four others the opposite. This achievement requires you to earn four friendships or 4 rivalries with your party members. Bethany or Carver count toward this achievement, even after they have left your party for good.
Note #1: In order for a companion to count toward this achievement, you must reach 100% on the rivalry or friendship bar. Simply unlocking the companion's special friendship/rivalry ability is not enough.
Note #2: You can’t mix and match friendships and rivalries. You must have four of one or the other. General tips can be found below:
Companion Quests: Doing companion quests will be the majority of what factors in to your relationship with your companions.
Conversation: Take in to consideration their personalities when you speak with them. How you speak about party members not currently in your party still effects how they think of you.
Actions: When taking your party members on missions with you, you must consider how they will react to the decisions you make.