No legitimate "sharing" of a Gold subscription exists. Xbox Live Gold is tied to a single Microsoft Account (Gamertag).
On Xbox One / Series X|S, you can set a console as your "Home Xbox." Then any profile on that console enjoys your Gold benefits (online multiplayer, Games with Gold, discounts).
This does NOT work on Xbox 360. The 360 lacks "Home Console" licensing. Gold is strictly per-profile.
Giving your login to a friend = TOS Violation. Risks: Permanent ban, purchase loss, security compromise. Don't do it.