relative position between 2 object

If i have object A and B in my game, where A can move around.
I want to set B with some x,y,z offset relative to A,
For example, A is at the position 0,0,0 and looking to the right,
if the offset are 5,0,3, then B will appear at the front left of A.
if the offset are -5,0,-5,then B will appear somewhere behind A.

In other word, i want A become the center of the world, and using some code like

B.transfrom.position=A.transfrom.position+new Vector3(xoffset,yoffset,zoffset);

How can i do that?

There are lots of possibilities, but without more of your game mechanic and code, it is hard to be specific. As I said your line of code above will work. Usually in a case like this one, there is a script on B that follows A. Something like:

var target : Transform;
var offset : Vector3;

function Update() {
    transform.position = target.position + offset;
}

This script would go on B, and ‘target’ would get initialized to A…either in the Inspector through drag and drop or in Start() using GameObject.Find() or GameObject.FindWithTag.