There's a say,
Don't study to compete with your friend. You'll end up getting the what you aimed for which is to get higher marks than your friend.
Study because you are willing to do so. To be excel in your life, to challenge yourself, to be a better you.
Then, you'll get the satisfaction of having such a meaningful victory, against yourself.