In Washington state the answer to this question is: mostly Yes, if you're not blocking or impeding traffic behind you.
Generally, if you are just riding with a friend you can ride next to each other shoulder to shoulder if there are no cars behind you. If a car comes up behind you, then you should form a signle file line t let the car pass. If you're traveling at the post speed limit, then you don't need to get over because you're not impeding or slowing down traffic.
Bicyclists should use their best judgment. Don't hold up traffic and use the shoulder as much as possible, share the road for your own safety.
If you are involved in a bicycle accident and you're not sure if you have partial fault or not in the accident, you should contact an experienced bicycle accident attorney to learn your rights in light of the specific facts of your case. If you want help now, call 888-230-4970!
Max Meyers Law