Hello Huy Pham
Yes, this is possible. Your friend can travel using the companion ticket while you are using the Swiss Travel Pass Youth. Yes, you have to purchase the companion ticket day by day. It has to bear the name of your friend, and you both have to travel with a valid passport or ID card (no photo, no paper copies).
The companion ticket is not valid for routes not fully covered by the Swiss Travel pass Youth yet grants a discount.
Alternatively, you could purchase the Friends Day Pass for Youth. It costs a total of CHF 80 per day, and offers free travel for up to 4 people under 25 years. The area of validity is available on its product website.
https://www.sbb.ch/en/tickets-offers/tickets/day-passes/friends-day-pass-youth.html
Kind regards,
Roland