Reply To: Override a BP class function
If you’re not using the Friends component, why not disable it under the BuddyPress components menu?
Uncheck “Friend Connections” and save.
If you’re using the wp_bp_friends table in weird ways. Disable the friends component and create your own custom component plugin referencing this table. You should really have created a new table and namespaced it differently to avoid these issues you’re running into.
You could also try removing the button:
remove_action( 'bp_member_header_actions', 'bp_add_friend_button', 5 );
This would need to be called before the page loads.