I think that KnifeMissile meant that the first piece of code does not compile, and that that is the correct thing. That code fails to compile because a Foo is not a Bar. A compiler can't "look inside" each struct and decide that they are equal even if their names differ. That's an impossible task. Rather, it looks at their types and makes a decision based on that.
In the second example, the type of Foo and Bar is the same:
Code:
typedef Value<int> Foo;
typedef Value<int> Bar;
Foo foo;
Bar bar = foo;
As far as the compiler is concerned a Foo is just a different name for Bar; after all they are both Value<int>'s. That's all. And that's why the code compiles correctly.
Casting struct Foo's to struct Bar's won't necessarily get you fired in the real world as long as you solve a problem that needed to be solved (sometimes you just
got to get down and dirty). But it's not a practice I'd advise doing if there's a viable alternative.