In other languages, differentiating between subject/object is done differently. example: "A doggo bit my friendee" or "My friendo bit a dogee" and you can see the difference. Word order is still somewhat relevant here because I didn't add endings to the verb too, which is commonplace in such languages. When you do that you are able to be far more free with word position:
My Friendee doggo bitto. Bitto My friendee doggo.
In this way it's easier to tell the subject/object difference.[1] To some degree this can be done in English and is exactly what Yoda does: "My friend a dog bit" but that sentence can be either of the ones you gave. Adding a comma may help "My friend, a dog bit" = "A dog bit my friend"
[1] This is exactly what Latin does and as rjf72 mentioned it gives more freedom. Many Latin authors put the verb at the end which gives you a sort of suspense as to just what is happening. In my second example I put the verb up front and the subject at the end which allows me to keep you in suspense as to who did the biting.